package com.haiyi.activiti.delegate;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * <p> </p>
 *
 * <pre> Created: 2018/11/28 9:26 </pre>
 *
 * @author hlu
 * @version 1.0
 * @since JDK 1.7
 */
@Component
public class ShoppingDelegate implements JavaDelegate {

    private final static Logger LOGGER = LoggerFactory.getLogger(ShoppingDelegate.class);

    /**
     * 确认货物是否充足
     * @param execution
     */
    @Override
    public void execute(DelegateExecution execution) {
        //理论上我们应该做一些逻辑判断是否还是充足的货物，这里只是一个例子，我们设置变量enough=true，永远都是充足
        execution.setVariable("enough",true);
        LOGGER.info("delegate执行成功");
    }

}
